package Map;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.FileInputFormat;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.jobcontrol.Job;
import org.apache.hadoop.mapred.lib.CombineTextInputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.log4j.BasicConfigurator;

import java.io.IOException;

public class MapReduce {
//    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
//        BasicConfigurator.configure();
//        Configuration conf = new Configuration();
//        String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
//        if (otherArgs.length != 2) {
//            System.err.println("Usage: wordcount <in> <out>");
//            System.exit(2);
//        }
//        Job job = new Job(conf, "job");
//        job.setJarByClass(Map.MapReduce.class);
//        job.setMapperClass(Map.Mapper.class);
//        job.setInputFormatClass(CombineTextInputFormat.class);
//        CombineTextInputFormat.setMinInputSplitSize(job, 2097152);
//        CombineTextInputFormat.setMaxInputSplitSize(job, 4194304);
//        job.setOutputKeyClass(Text.class);
//        job.setOutputValueClass(Text.class);
//        FileInputFormat.addInputPath(job,new Path(otherArgs[0]));
//        FileOutputFormat.setOutputPath(job,new Path(otherArgs[1]));
//        System.exit(job.waitForCompletion(true) ? 0 : 1);
//    }
}